package com.kusiri.kframework.salesforce.ui.component
{
	import com.kusiri.kframework.salesforce.model.IKfSalesforceModel;
	import com.kusiri.kframework.salesforce.ui.SObjectSearch;
	import com.kusiri.kframework.ui.KfUiComponent;
	
	import mx.core.IFlexDisplayObject;

	public class KfSObjectSearch extends KfUiComponent implements IKfSObjectSearch
	{
		private var _model : IKfSalesforceModel;
		
		public function get model() : IKfSalesforceModel
		{
			return _model;
		}
		
		public function set model( model : IKfSalesforceModel ) : void
		{
			_model = model;
		}
		 
		private var _resultsInNewWindow : Boolean = true;
		
		public function get resultsInNewWindow() : Boolean
		{
			return _resultsInNewWindow;
		}
		
		public function set resultsInNewWindow( flag : Boolean ) : void
		{
			_resultsInNewWindow = flag;
		}
		
		private var self : KfSObjectSearch;
		
		/**
		 * This is is the layout
		 */
		private var uiComponent : SObjectSearch = new SObjectSearch(); 
		
		public function KfSObjectSearch()
		{
			super();
			self = this;
		}
	
		/**
		 * Get the Flex UI Component
		 */
		override public function get __uiComponent() : IFlexDisplayObject
		{
			return uiComponent;
		}

		/**
		 * Tell the UI Component to load its data.
		 */
		override public function __initializeComponent(onSuccess : Function, onFail : Function) : void
		{
			uiComponent.model = model;
			uiComponent.resultsInNewWindow = resultsInNewWindow;
			onSuccess(this);
		}
		
	}
}